//
//  goodCell.m
//  BeautyClother
//
//  Created by dllo on 15/8/22.
//  Copyright (c) 2015年 宋爽. All rights reserved.
//

#import "goodCell.h"

@interface goodCell ()
@property (nonatomic, assign) CGFloat offWidth;
@property (nonatomic, assign) CGFloat offHeight;

@end

@implementation goodCell



- (void)dealloc
{
    [_image release];
    [_userAvatar release];
    [_roleIcons release];
    [_userName release];
    [_title release];
    [_content release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.offWidth = [[UIScreen mainScreen]bounds].size.width / 375;
        self.offHeight = [[UIScreen mainScreen]bounds].size.height / 667;
        self.image = [[UIImageView alloc]init];
        [self.contentView addSubview:self.image];
        [_image release];
        
        self.userAvatar = [[UIImageView alloc]init];
        [self.contentView addSubview:self.userAvatar];
        [_userAvatar release];
        
        self.roleIcons = [[UIImageView alloc]init];
        [self.contentView addSubview:self.roleIcons];
        [_roleIcons release];
        
        self.userName = [[UILabel alloc]init];
        [self.contentView addSubview:_userName];
        [_userName release];
        
        self.title = [[UILabel alloc]init];
        [self.contentView addSubview:self.title];
        [_title release];
        
        self.content = [[UILabel alloc]init];
        [self.contentView addSubview:self.content];
        [_content release];
        
        self.share = [UIButton buttonWithType:UIButtonTypeSystem];
        [self.contentView addSubview:self.share];
        
        self.visit = [UIButton buttonWithType:UIButtonTypeSystem];
        [self.contentView addSubview:self.visit];
        
        self.comment = [UIButton buttonWithType:UIButtonTypeSystem];
        [self.contentView addSubview:self.comment];
        
        
        
    }
    return self;
}


- (void)layoutSubviews
{
    [super layoutSubviews];
    self.image.frame = CGRectMake(5 *_offWidth, 5 *_offHeight, self.frame.size.width - 10 *_offWidth, 220 *_offHeight);
    self.userAvatar.frame = CGRectMake(10 *_offWidth, 205 *_offHeight, 40 *_offWidth, 40 *_offHeight);
    _userAvatar.layer.cornerRadius = 40 *_offWidth / 2;
    _userAvatar.layer.masksToBounds = YES;

    self.userName.frame = CGRectMake(70 *_offWidth, 230 * _offHeight, 100 * _offWidth, 40 * _offHeight);
    self.roleIcons.frame = CGRectMake(180 *_offWidth, 240 * _offHeight, 100 * _offWidth, 20 * _offHeight);
    self.title.frame = CGRectMake(20 *_offWidth, 280 * _offHeight, 300 *_offWidth, 40 * _offHeight);
    self.title.textColor = [UIColor darkGrayColor];
    self.content.frame = CGRectMake(20 *_offWidth, 320 * _offHeight, self.frame.size.width - 40 *_offWidth , 60 * _offHeight);
    self.content.numberOfLines = 2;
    self.content.font = [UIFont systemFontOfSize:15];
    self.content.textColor = [UIColor lightGrayColor];
    
    self.share.frame = CGRectMake(25 *_offWidth, 380 * _offHeight, 30 *_offWidth, 20 * _offHeight);
    [self.share setImage:[UIImage imageNamed:@"lianjie.png"] forState:UIControlStateNormal];
    [self.share setTintColor:[UIColor darkGrayColor]];
    [self.share setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
    self.visit.frame = CGRectMake(60 *_offWidth, 380 * _offHeight, 80 *_offWidth, 20 * _offHeight);
    [self.visit setImage:[UIImage imageNamed:@"v.png"] forState:UIControlStateNormal];
    [self.visit setTintColor:[UIColor darkGrayColor]];
    [self.visit setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
    self.comment.frame = CGRectMake(160 *_offWidth, 380 * _offHeight, 50 *_offWidth, 20 * _offHeight);
    [self.comment setImage:[UIImage imageNamed:@"comm.png"] forState:UIControlStateNormal];
    [self.comment setTintColor:[UIColor darkGrayColor]];
    [self.comment setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
